package fox.framework.rpc.endpoint;

import fox.framework.rpc.client.node.RpcNode;
import fox.framework.rpc.endpoint.channel.RpcChannel;
import fox.framework.rpc.exception.RpcException;
import fox.framework.rpc.exception.RpcRuntimeException;
import fox.framework.rpc.server.dispatcher.RpcRequestDispatcher;

/**
 * RPC消息终端
 *
 * @author cuichao
 * @Description: RpcEndPoint
 * @Date: create in 2020/12/29 15:41
 */
public interface RpcEndPoint {
    /**
     * 请求执行器
     *
     * @return
     */
    void setRequestDispatcher(RpcRequestDispatcher dispatcher);

    /**
     * 启动节点服务
     */
    void publish() throws RpcException;

    /**
     * 连接一个远程Rpc节点
     * @param node
     * @return
     * @throws RpcRuntimeException
     */
    RpcChannel connection(RpcNode node) throws RpcRuntimeException;

    /**
     * 关闭服务
     */
    void shutdown() throws RpcRuntimeException;


}
